<?php
if(!isset($_GET['url'])=='' && !isset($_POST['url'])==''){
    header('location:index.php');
}
session_start();
include_once 'comm/config.php';
include_once 'comm/checkpostandget.php';

$url=$_GET['url']?base64_decode($_GET['url']):base64_decode($_POST['url']);
$uid=$_SESSION['dduserid']?$_SESSION['dduserid']:0;
$url=preg_replace('/mm_(.*?)_0_0/','mm_'.MYUSERPID.'_0_0',$url);
$input_arr=array('url'=>base64_encode($url));
if($uid>0 && $url!=''){
	$url=add_uid_jump_url($url,$uid);
	echo "<script>window.location='".$url."'</script>";
	exit;
}
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>淘宝返利 - <?=WEBTITLE?></title>
<link type="text/css" rel="stylesheet" href="css/alert.css" />
<link type="text/css" rel="stylesheet" href="css/goto.css" />

<script type="text/javascript" src="js/jquery.js"></script>
<script type="text/javascript" src="template/<?=MOBAN?>/js/base64.js"></script>
<script type="text/javascript" src="template/<?=MOBAN?>/js/function.js"></script>
<script type="text/javascript" src="js/fun.js"></script>
<script type="text/javascript" src="js/error.js"></script>
<style>
#desc{height:45px;font-size:14px;font-weight:bold}
#desc big{font-size:16px;color:#f00}
</style>
<script type="text/javascript">
function doEnter()
{
	document.getElementById("pw1").style.display="none";
	document.getElementById("password1").style.display="block";
	document.getElementById("password1").focus();
}
</script>
</head>
<body>
<iframe frameborder="0" scrolling="no" src="<?=$url?>" marginwidth="0" marginheight="0" width="100%" class="ifrnameurl" id="flboxcontent"></iframe>


<?php if($uid>0){?>
<div class="login_reg" style="text-align:center">
<form name="loading" style=" width:100%;">
<div id="desc"><?=WEBTITLE?>正在带您去<big>淘宝</big>（最高返<span style='color:#BD0000;'><?=$fan?></span>），请稍等</div>
<div id="tip" style="height:40px">
<input type=text name=chart size=46 style="font-family:Arial; font-weight:bolder; color:#fe6d01; background-color:#fff; padding:0px; border-style:none;">
<input name=percent size=47 style="color:#0066ff; text-align:center; border-width:medium; border-style:none;" type="hidden">
 </div>
 </form>
  </div>
<script>
function doClick(){
    var o=document.getElementById('goto');
    if(document.all){
        o.click();
    }else{
        window.location=o.href;
    }
}

var bar=0　 
var line="||"　 
var amount="||"　 
count();

function count(){　 
    bar=bar+2　 
    amount =amount + line　 
    document.loading.chart.value=amount　 
    document.loading.percent.value=bar+"%"　 
    if (bar<99){
		setTimeout("count()",10);
	}　 
    else{
        doClick();
    }　 
}
</script>
<?php }else{?>
<div class="boxframe" id="alert_fast_log_reg">
 <a href="<?=$url?>"><div class="close"></div></a>
 <div class="box">
 	<div class="l1">亲爱的，您还没有<font style="color:#FFF">登录</font>，请按照下面的方式获得米！</div>
    <div class="l2">
      <div class="pic" style="width:235px;height:81px;margin-left:140px;margin-top:15px;display:inline"><img src="template/<?=MOBAN?>/images/logo_mess.gif" width="235" height="71" border="0" /></div>
    </div>
    <form action="" method="post" onsubmit="return ajaxLogin(this)">
    <div class="login">
      <div class="edit"><input type="text"  tabindex="1" name="ddusername" id="username1" value="这里输入账号" class="e"/></div>
      <div class="edit">
        <input type="text" tabindex="2" name="pw1" id="pw1" onfocus="doEnter();" value="这里输入密码" class="e" />
        <input type="password" tabindex="2" name="dduserpwd" id="password1" value="" style="display:none" class="e" />
      </div>
      <input type="hidden" name="submit" value="1" />
      <div class="bnt"><input type="submit" value="登录返米" class="button" /></div>
    </div>
    </form>
    <div class="reg">
      <div class="t"><a href="user/register.php" target="_blank">您还没有账号？现在就注册></a></div>
      <div class="t"><a href="<?=$url?>">不想攒米，先去看看></a></div>
    </div>
 </div>
</div>
<?php }?>
</div>
</div>

</div>
<a id="goto" href="<?=$url?>">&nbsp;</a>
<script src="js/jquery.validate.js"></script>
<script type="text/javascript">
input=new Array();
input['url']='<?=base64_encode($url)?>';
(function($) {
    var iheight;
    iheight = $(window).height();
    $('#flboxcontent').attr('height', iheight + 'px');
    $(window).resize(function() {
        iheight = $(window).height();
        $('#flboxcontent').attr('height', iheight + 'px');
    });
    var top = $(window).height() / 2 - $("#alert_fast_log_reg").height() / 2;
    var left = $(window).width() / 2 - $("#alert_fast_log_reg").width() / 2;
    $("#alert_fast_log_reg").css("left", left);
    $("#alert_fast_log_reg").css("top", top);
})(jQuery);

$(function(){
    $('.l_r_menu li a').click(function(){
	    $('.l_r_menu li a').removeClass('current');
		var classname=$(this).attr('class');
		if(classname=='l_log'){
		    $('#reg').hide();
			$('#log').show();
		}
		else if(classname=='l_reg'){
		    $('#log').hide();
			$('#reg').show();
		}
		$(this).addClass('current');
	});
});

function ajaxLogin(t){
	$.post('ajax.php?fun=checkLogin',$(t).serialize(),function(data){
		if(parseInt(data)>0){
			postForm('gotos8.php',input);
		}
		else{
		    alert('账号密码错误');
		}
	});
	return false;
}

$(function(){
    $('#register_form').validate({
        errorPlacement: function(error, element){
            var error_td = element.parent('td').next('td');
            error_td.find('.field_notice').hide();
            error_td.append(error);
        },
        success       : function(label){
            label.addClass('validate_right').text('OK!');
        },
        onkeyup: false,
        rules : {
            username : {
                required : true,
                byteRange: [3,15,'utf-8']
            },
            password : {
                required : true,
                minlength: 6
            },
            password_confirm : {
                required : true,
                equalTo  : '#password'
            },
            email : {
                required : true,
                email    : true
            },
            qq : {
                required : true,
                range:[1000,999999999999]
            },
			captcha : {
                required : true,
                rangelength:[4,4],
				digits:true
            }
        },
        messages : {
            username : {
                required : '您必须提供一个用户名',
                byteRange: '用户名必须在3-15个字符之间'
            },
            password  : {
                required : '您必须提供一个密码',
                minlength: '密码长度应在6-20个字符之间'
            },
            password_confirm : {
                required : '您必须再次确认您的密码',
                equalTo  : '两次输入的密码不一致'
            },
            email : {
                required : '您必须提供您的电子邮箱',
                email    : '这不是一个有效的电子邮箱'
            },
			qq : {
                required : '您必须提供您的QQ号码',
                range:'QQ号码位数错误'
            },
            captcha : {
                required : '请输入右侧图片中的字符',
				rangelength    : '位数错误',
				digits   : '这不是一个数字'
            }
        },
		submitHandler: function(form) {
            $.post('register.mod.php',$('#register_form').serialize(),function(data){//alert(data);
		        if(data=='ok'){
		            postForm('goto.php?act=<?=$act?>',input);
		        }
		        else{
		            alert(errorArr[data]);
		        }
	        });
        }
    });
});
</script>

</body>
</html>
